<?php
$objUserForm = new BM_PHPForm();
$objUserForm->UseLocator();
$objUserForm->SetIndent("          ");

$entUser = UserController::find($id);

if ($objUserForm->IsPost()){

	$objUserForm->ChEmptiness("newpassword" , "New Password is empty.");
	$objUserForm->ChMinLength("newpassword" , "New Password must be more than 4 chars.", 4);
	$objUserForm->ChMaxLength("newpassword" , "New Password must be less than 12 chars.", 12);
	$objUserForm->ChCustomVal("newpassword2", "New Passwords must be same.",$objUserForm->arrPostData['newpassword']==$objUserForm->arrPostData['newpassword2'] );
	if ($objUserForm->IsValid()){
		$entUser = new User($entUser->username,md5($objUserForm->arrPostData['newpassword']),"");
		UserController::updatep($entUser);
		$objUserForm->SetInfor("submit","Password Updated Successfully !");
	}	
}

print $objUserForm->ErrMsgs();
print $objUserForm->InfMsgs();

print $objUserForm->Open("userform","User Registration");
print $objUserForm->HiddenField("action" ,"$action");
print $objUserForm->HiddenField("id" ,"$id");
print $objUserForm->TextBox("username" ,"Username:","$entUser->username",array('readonly'=>'readonly'));
print $objUserForm->TextBox("newpassword" ,"New Password:","",array(),"password");
print $objUserForm->TextBox("newpassword2" ,"Confirm Password:","",array(),"password");
print $objUserForm->SubmitButton("submit", "Update", array(), "submit");
print $objUserForm->Close();
?>